﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MediaCenterCommander.UserAgent.UI.Options
{
    /// <summary>
    /// Interaction logic for OptionsWindow.xaml
    /// </summary>
    public partial class OptionsWindow : Window
    {
        public OptionsWindow()
        {
            InitializeComponent();
        }

        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            this.autoStartupCheckbox.IsChecked = Util.StartupRegistrationHelper.IsRegisteredToStartAtLogin;

            this.autoStartupCheckbox.Checked += new RoutedEventHandler(autoStartupCheckbox_Checked);
            this.autoStartupCheckbox.Unchecked += new RoutedEventHandler(autoStartupCheckbox_Unchecked);
        }

        void autoStartupCheckbox_Unchecked(object sender, RoutedEventArgs e)
        {
            Util.StartupRegistrationHelper.UnregisterToStartAtLogin();
        }

        void autoStartupCheckbox_Checked(object sender, RoutedEventArgs e)
        {
            Util.StartupRegistrationHelper.RegisterToStartAtLogin();
        }                
    }
}
